package com.bread.tliaswebmanagement.controller;

import com.bread.tliaswebmanagement.pojo.ClazzCountStatistic;
import com.bread.tliaswebmanagement.pojo.JobStatistc;
import com.bread.tliaswebmanagement.pojo.Result;
import com.bread.tliaswebmanagement.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/empJobData")
    public Result getEmpJobStatistic(){
        log.info("统计员工职位人数");
        JobStatistc jobStatistc = reportService.getEmpJobStatistic();
        return Result.success(jobStatistc);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderStatistic(){
        log.info("统计员工性别人数");
        List<Map<String, Object>> genderStatistic = reportService.getEmpGenderStatistic();
        return Result.success(genderStatistic);
    }

    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeStatistic(){
        log.info("统计学生学历人数");
        List<Map<String, Object>> studentDegreeStatistic = reportService.getStudentDegreeStatistic();
        return Result.success(studentDegreeStatistic);
    }

    @GetMapping("/studentCountData")
    public Result getClazzCountStatistic(){
        log.info("统计每班人数");
        ClazzCountStatistic clazzCountStatistic = reportService.getClazzCountStatistic();
        return Result.success(clazzCountStatistic);
    }

}
